package com.common.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @className: MyBatisPlusConfig
 * @description: MyBatisPlus配置类
 * @author: Li Chuanwei
 * @date: 2024/02/03 17:25
 * @Company: Copyright [日期] by [作者或个人]
 **/
@Configuration
@MapperScan(basePackages ="com.mapper.mybatis")
public class MyBatisPlusConfig {
    @Bean
    /**
     * 配置MybatisPlus中的插件
     */
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
        interceptor.addInnerInterceptor(paginationInterceptor);
        return interceptor;
    }
}
